import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/components/Layout/SaaSLayout'
import Login from 'alinesno-ui/packages/Login/Login'

Vue.use(VueRouter)

// >>>>>>>>>>> TODO 提取出公共路由 >>>>>>>>>>>>>>>>
export const constantRoutes = [{
    path: '',
    component: Layout,
    redirect: 'index',
    children: [{
        path: 'index',
        component: (resolve) => require(['@/views/dashboard/home'], resolve),
        name: '首页'
      },
      {
        path: '/dashboard/document',
        component: (resolve) => require(['alinesno-ui/src/views/dashboard/document'], resolve),
        name: '文档服务',
        hidden: true
      },
      {
        path: '/dashboard/notifications',
        component: (resolve) => require(['alinesno-ui/src/views/dashboard/notifications'], resolve),
        name: '消息管理',
        hidden: true
      },
      {
        path: '/dashboard/workorder',
        component: (resolve) => require(['alinesno-ui/src/views/dashboard/workorder'], resolve),
        name: '工单管理',
        hidden: true
      },
      {
        path: '/dashboard/platform/service',
        component: (resolve) => require(['alinesno-ui/src/views/dashboard/service/Support'], resolve),
        name: '支持管理',
        hidden: true
      },
      {
        path: '/views/portal/ucenter/account/list',
        component: (resolve) => require(['@/views/portal/ucenter/account/list'], resolve),
        name: '账号管理',
        hidden: true
      },
      {
        path: '/views/portal/ucenter/department/list',
        component: (resolve) => require(['@/views/portal/ucenter/department/list'], resolve),
        name: '部门管理',
        hidden: true
      },
      {
        path: '/views/portal/ucenter/role/list',
        component: (resolve) => require(['@/views/portal/ucenter/role/list'], resolve),
        name: '角色管理',
        hidden: true
      },
      {
        path: '/views/portal/ucenter/tenant/list',
        component: (resolve) => require(['@/views/portal/ucenter/tenant/list'], resolve),
        name: '租户管理',
        hidden: true
      },
      {
        path: '/views/portal/ucenter/project/list',
        component: (resolve) => require(['@/views/portal/ucenter/project/list'], resolve),
        name: '添加应用',
        hidden: true
      },
      {
        path: '/dashboard/user/profile',
        component: (resolve) => require(['alinesno-ui/packages/Ucenter/profile/index'], resolve),
        name: '用户中心',
        hidden: true ,
        meta: { title: '用户中心', icon: 'fas fa-chalkboard', noCache: true, affix: true }
      } ,
      {
        path: '/portal/ucenter/sysJobLog/list',
        component: (resolve) => require(['@/views/portal/ucenter/sysJobLog/list'], resolve),
        name: '添加渠道',
        hidden: true
      },
    ]
  },
  {
    path: '/login',
    component: Login,
    hidden: true
  },
  {
    path: '/404',
    component: (resolve) => require(['alinesno-ui/src/views/error/404'], resolve),
    hidden: true
  },
  {
    path: '/401',
    component: (resolve) => require(['alinesno-ui/src/views/error/401'], resolve),
    hidden: true
  },
  //router 路由声明
  {
    path: '/portal/ucenter',
    component: Layout,
    hidden: true,
    redirect: 'noredirect',
    children: [{
      path: 'managerResource/:applicationId',
      component: () => import('@/views/portal/ucenter/managerResource/list.vue'),
      name: 'ManagerResource',
      meta: {
        title: '菜单配置'
      }
    }]
  },
]

export default new VueRouter({
  mode: 'history', // 去掉url中的#
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRoutes
})
